package com.example.orderservice.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * Created with IntelliJ IDEA 2023.
 * Description:
 * User: 故我
 * Date: 2024-02-13
 * Time: 17:06
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private ServletWebServerApplicationContext context;

    @RequestMapping("/getorder")
    public String getOrder() {
        return "Port: " + context.getWebServer().getPort() +
                " | OrderService: " + new Random().nextInt(200);
    }
}
